package com.atguigu.executor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * ThreadPoolConfig
 *
 * @author yangchao
 * @version 开发阶段
 * @description TODO
 * @date 2022/2/8 21:45
 */

public class MyExecutor {
    private static ThreadPoolExecutor executor=
        new ThreadPoolExecutor(
                10,
                50,
                30,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(100)
                // 线程池工厂，拒绝策略
        );

    public static ThreadPoolExecutor getInstance(){
        return executor;
    }

}
